package com.system.common.config;

import com.system.common.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        LoginInterceptor loginInterceptor = new LoginInterceptor();
        registry.addInterceptor(loginInterceptor)
                // 拦截所有请求
                .addPathPatterns("/**")
                // 不拦截的请求：登录相关、注册相关、验证码相关
                .excludePathPatterns(
                        "/login/**",          // 原有的登录模块接口（如登录接口、获取验证码接口若在/login下）
                        "/Upload/**",
                        "/admin/**",
                        "/address/**",
                        "/user/**",
                        "/type/**",
                        "/orders/**"
                        // 原有的注册模块接口

                );
    }
}